<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>查看文件</title>
    <link rel="shortcut icon" href="favicon.ico">
    <link href="__CSS__/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="__CSS__/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="__CSS__/animate.min.css" rel="stylesheet">
    <link href="__JS__/layui/css/layui.css" rel="stylesheet">
    <link href="__CSS__/style.min.css?v=4.1.0" rel="stylesheet">
</head>

<body class="gray-bg">
    <div class="wrapper wrapper-content animated">
        <div class="row">
            <div class="col-sm-8 col-xs-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>查看文件</h5>
                    </div>
                    <div class="ibox-content">
                        <form class="form-horizontal m-t layui-form" id="commentForm" method="post" action="{:url('examine/edit')}?uploadFile=1">
                            <input type="hidden" value="{$info['id']}" name="id" />
                            <div class="form-group">
                                <label class="col-sm-3 col-xs-4 control-label">顾客名称：</label>
                                <div class="input-group col-sm-4 col-xs-6">
                                    <input type="text" class="form-control" required="" aria-required="true" value="{$info['name']}" readonly>
                                </div>
                            </div>
                            <div class="form-group layui-form-item form-inline" style="height: 60px;">
                                <label class="col-sm-3 col-xs-4 control-label">用户头像：</label>
                                <div class="input-group col-sm-4 col-xs-6 " id="avatar">
                                    <img src="{$info['headimgurl']}" width="40px" height="40px" />
                                </div>
                            </div>
                            <!-- <div class="form-group">
                                <label class="col-sm-3 col-xs-4 control-label">手机号：</label>
                                <div class="input-group col-sm-4 col-xs-6">
                                    <input id="openid" type="text" class="form-control" placeholder="" readonly value="{$info['mobile']}">
                                </div>
                            </div> -->
                            <!-- <div class="form-group layui-form-item">
                                <label class="col-sm-3 col-xs-4 control-label">项目消耗表</label>
                                <div class="input-group col-sm-4 col-xs-6">
                                    <input type="hidden" readonly class="form-control" value="{$info['user_file1']}" id="user_file1" name="user_file1" />
                                    <a target="_blank" id="file_download_1" href="{$info['user_file1_pre'] ?: 'javascript:void(0)'}" class="layui-btn layui-btn-normal layui-btn-sm {$info['user_file1'] ? '' : 'layui-btn-disabled'}">点击查看</a>
                                </div>
                            </div> -->
                            <div class="form-group layui-form-item">
                                <label class="col-sm-3 col-xs-4 control-label">见诊档案</label>
                                <div class="input-group col-sm-4 col-xs-6">
                                    <input type="hidden" readonly class="form-control" value="{$info['user_file2']}" id="user_file2" name="user_file2" />
                                    <a target="_blank" id="file_download_2" href="{$info['user_file2_pre'] ?: 'javascript:void(0)'}" class="layui-btn layui-btn-normal layui-btn-sm {$info['user_file2'] ? '' : 'layui-btn-disabled'}">点击查看</a>
                                </div>
                            </div>
                            <div class="form-group layui-form-item">
                                <label class="col-sm-3 col-xs-4 control-label">咨询记录表</label>
                                <div class="input-group col-sm-4 col-xs-6">
                                    <input type="hidden" readonly class="form-control" value="{$info['user_file3']}" id="user_file3" name="user_file3" />
                                    <a target="_blank" id="file_download_3" href="{$info['user_file3_pre'] ?: 'javascript:void(0)'}" class="layui-btn layui-btn-normal layui-btn-sm {$info['user_file3'] ? '' : 'layui-btn-disabled'}">点击查看</a>
                                </div>
                            </div>
                            <div class="form-group layui-form-item">
                                <label class="col-sm-3 col-xs-4 control-label">上传</label>
                                <!-- <button type="button" class="layui-btn layui-btn-sm upload_files" lay-data="{target: '#user_file1', download: '#file_download_1'}">项目消耗表</button> -->
                                <button type="button" class="layui-btn layui-btn-sm upload_files" lay-data="{target: '#user_file2', download: '#file_download_2'}">见诊档案</button>
                                <button type="button" class="layui-btn layui-btn-sm upload_files" lay-data="{target: '#user_file3', download: '#file_download_3'}">咨询记录表</button>
                            </div>
                            <div class="form-group">
                                <div class="col-sm-4 col-sm-offset-6">
                                    <button class="btn btn-primary" type="submit">提交</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>

            </div>
        </div>
    </div>
    <script src="__JS__/jquery.min.js?v=2.1.4"></script>
    <script src="__JS__/bootstrap.min.js?v=3.3.6"></script>
    <script src="__JS__/content.min.js?v=1.0.0"></script>
    <script src="__JS__/plugins/validate/jquery.validate.min.js"></script>
    <script src="__JS__/plugins/validate/messages_zh.min.js"></script>
    <script src="__JS__/plugins/layer/layer.min.js"></script>
    <script src="__JS__/layui/layui.js"></script>
    <script src="__JS__/jquery.form.js"></script>
    <script type="text/javascript">
        layui.use(['form', 'upload'], function() {
            var form = layui.form;
            var upload = layui.upload;

            //同时绑定多个元素，并将属性设定在元素上
            upload.render({
                elem: '.upload_files',
                url: '/admin/upload/uploadFile',
                accept: 'file',
                exts: 'zip|rar|xlsx|xls|doc|docx',
                done: function(res, index, upload) {
                    $(this.target).val(res.data.src)
                    $(this.download).removeClass('layui-btn-disabled').attr('href', res.data.preview_url)
                }
            })


        });

        var index = '';

        function showStart() {
            index = layer.load(0, {
                shade: false
            });
            return true;
        }

        function showSuccess(res) {

            layer.ready(function() {
                layer.close(index);
                if (1 == res.code) {
                    layer.alert(res.msg, {
                        title: '友情提示',
                        icon: 1,
                        closeBtn: 0
                    }, function() {
                        window.location.href = res.data;
                    });
                } else if (111 == res.code) {
                    window.location.reload();
                } else {
                    layer.msg(res.msg, {
                        anim: 6
                    });
                }
            });
        }

        $(document).ready(function() {
            // 添加管理员
            var options = {
                beforeSubmit: showStart,
                success: showSuccess
            };

            $('#commentForm').submit(function() {
                $(this).ajaxSubmit(options);
                return false;
            });
        });

        // 表单验证
        $.validator.setDefaults({
            highlight: function(e) {
                $(e).closest(".form-group").removeClass("has-success").addClass("has-error")
            },
            success: function(e) {
                e.closest(".form-group").removeClass("has-error").addClass("has-success")
            },
            errorElement: "span",
            errorPlacement: function(e, r) {
                e.appendTo(r.is(":radio") || r.is(":checkbox") ? r.parent().parent().parent() : r.parent())
            },
            errorClass: "help-block m-b-none",
            validClass: "help-block m-b-none"
        });
    </script>
</body>

</html>
